<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>

		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			<h1>使用组件</h1>
			计数器:<counter></counter><br />
			计数器:<counter></counter><br />
		</div>

		<script>
			// 定义组件
			const localCompent = {
				data() {
					return {
						count: 0
					}
				},
				template:'<button @click="count++">{{count}}</button>'
			}
			
			var app = Vue.createApp({
				data() {
					return {
						"message": "Hello Vue!"
					}
				},
				// 局部组件 写在另外一个组件的componets选项中
				components:{					
					'counter':localCompent
				}
			});
			
			var vm = app.mount("#app")
		</script>



	</body>
</html>